# Generates online and print versions of SGML source file.
BASENAME=sybase

# SGML source file.
DOCBOOK_FILE=$(BASENAME).xml
STYLESHEET=db2latex.xsl

# Generated files.
TEX_FILE=$(BASENAME).tex
PDF_FILE=$(BASENAME).pdf

# Build rules.
tex: $(TEX_FILE)

pdf: $(PDF_FILE)

all: tex pdf

clean:
	 rm -f $(BASENAME).{htm,log,aux,ps,pdf,tex,dvi,rtf,fot,brf,out}
	 rm -f *~
	 rm -f *.html

distclean: clean
	 rm -f $(BASENAME).tgz

package:
	 rm -f $(BASENAME).tgz
	 tar -C .. -czf /tmp/$(BASENAME).tgz $(BASENAME)
	 mv /tmp/$(BASENAME).tgz .

dist: clean package

distall: all package

# Compile rules.
$(TEX_FILE):
	xsltproc $(STYLESHEET) $(DOCBOOK_FILE) > $(TEX_FILE)

$(PDF_FILE): $(TEX_FILE)
	sed -i 's/portugese/portuges/g' $(TEX_FILE); \
	pdflatex $(TEX_FILE); \
	pdflatex $(TEX_FILE); \
	pdflatex $(TEX_FILE)


